/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import management.ObjectDispatcher;
import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Image;
import physics.BlockMap;
import physics.Physics;

/**
 *
 * @author wida46061976
 */
public class TransitionObject extends EntityObject {

    private float destX;
    private float destY;
    private String TMX;
    private int zone;

    public TransitionObject() {
        setAnimation(new Animation());
        try {
            getAnimation().addFrame(new Image("resources/openDoor.png"), 1000);
            setPosX(306);
            setPosY(33);
            setPoly(getPosX(), getPosX() + 64, getPosY() + 27, getPosY() + 64);
            setTMX("resources/Zone1.tmx");
            destX = 224;
            destY = 521;
            zone = 2;
            setActivated(true);
        } catch (Exception e) {
            System.out.println(e);
        }
    }

    public TransitionObject(float destX, float destY, String TMX, int zone, float PosX, float PosY, boolean act) {
        try {
            getAnimation().addFrame(new Image("resources/openDoor.png"), 1000);
            setPosX(PosX);
            setPosY(PosY);
            setPoly(getPosX(), getPosX() + 64, getPosY() + 27, getPosY() + 64);
            this.TMX=TMX;
            this.destX = destX;
            this.destY = destY;
            this.zone = zone;
            setActivated(act);
        } catch (Exception e) {
            System.out.println(e);
        }

    }

    public String getTMX() {
        return TMX;
    }

    public void setTMX(String TMX) {
        this.TMX = TMX;
    }

    public float getDestX() {
        return destX;
    }

    public void setDestX(float destX) {
        this.destX = destX;
    }

    public float getDestY() {
        return destY;
    }

    public void setDestY(float destY) {
        this.destY = destY;
    }

    public int getZone() {
        return zone;
    }

    public void setZone(int zone) {
        this.zone = zone;
    }

    public void goes(PlayableChar player) {
        if (isActivated()) {
            try {
                new BlockMap(TMX);
                player.setPosX(destX);
                player.setPosY(destY);
                ObjectDispatcher.setZone(zone);
            } catch (Exception e) {
                System.out.println(e);
            }
        }
    }
}
